{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "deepQA_colab train",
      "version": "0.3.2",
      "provenance": [],
      "collapsed_sections": [],
      "include_colab_link": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "accelerator": "GPU"
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/yejianfeng2014/colab/blob/master/deepQA_colab_train.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "H36TS1kVgNmx",
        "colab_type": "text"
      },
      "source": [
        "#这个是使用google colab 训练deepQa的模型的示例过程\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "AqNFcxMFgGMX",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 470
        },
        "outputId": "94e3adcf-a208-4294-862d-da7cb2efa081"
      },
      "source": [
        "# 查看当前机器的硬件配置 ，记得需要点击修改菜单，然后把笔记本修改，然后硬件加速把gpu 选上保存，然后才可以看到GPU的相关配置\n",
        "from tensorflow.python.client import device_lib\n",
        "device_lib.list_local_devices()"
      ],
      "execution_count": 1,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "[name: \"/device:CPU:0\"\n",
              " device_type: \"CPU\"\n",
              " memory_limit: 268435456\n",
              " locality {\n",
              " }\n",
              " incarnation: 8007125518913227728, name: \"/device:XLA_CPU:0\"\n",
              " device_type: \"XLA_CPU\"\n",
              " memory_limit: 17179869184\n",
              " locality {\n",
              " }\n",
              " incarnation: 11614982521465198488\n",
              " physical_device_desc: \"device: XLA_CPU device\", name: \"/device:XLA_GPU:0\"\n",
              " device_type: \"XLA_GPU\"\n",
              " memory_limit: 17179869184\n",
              " locality {\n",
              " }\n",
              " incarnation: 6993485303083074542\n",
              " physical_device_desc: \"device: XLA_GPU device\", name: \"/device:GPU:0\"\n",
              " device_type: \"GPU\"\n",
              " memory_limit: 11330115994\n",
              " locality {\n",
              "   bus_id: 1\n",
              "   links {\n",
              "   }\n",
              " }\n",
              " incarnation: 14870680633122331841\n",
              " physical_device_desc: \"device: 0, name: Tesla K80, pci bus id: 0000:00:04.0, compute capability: 3.7\"]"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 1
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "6Yr2XAnmh4vG",
        "colab_type": "text"
      },
      "source": [
        "执行下面的命令，如果遇到输入框就点击上面的链接把验证码输入进去（如果没有账号注册）"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ApcL_pPGgb5m",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 222
        },
        "outputId": "cabc3ad6-c910-443c-bfb7-880d406afaee"
      },
      "source": [
        "!apt-get install -y -qq software-properties-common python-software-properties module-init-tools\n",
        "!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null\n",
        "!apt-get update -qq 2>&1 > /dev/null\n",
        "!apt-get -y install -qq google-drive-ocamlfuse fuse\n",
        "from google.colab import auth\n",
        "auth.authenticate_user()\n",
        "from oauth2client.client import GoogleCredentials\n",
        "creds = GoogleCredentials.get_application_default()\n",
        "import getpass\n",
        "!google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL\n",
        "vcode = getpass.getpass()\n",
        "!echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}"
      ],
      "execution_count": 2,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "E: Package 'python-software-properties' has no installation candidate\n",
            "Selecting previously unselected package google-drive-ocamlfuse.\n",
            "(Reading database ... 131183 files and directories currently installed.)\n",
            "Preparing to unpack .../google-drive-ocamlfuse_0.7.6-0ubuntu1~ubuntu18.04.1_amd64.deb ...\n",
            "Unpacking google-drive-ocamlfuse (0.7.6-0ubuntu1~ubuntu18.04.1) ...\n",
            "Setting up google-drive-ocamlfuse (0.7.6-0ubuntu1~ubuntu18.04.1) ...\n",
            "Processing triggers for man-db (2.8.3-2ubuntu0.1) ...\n",
            "Please, open the following URL in a web browser: https://accounts.google.com/o/oauth2/auth?client_id=32555940559.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&response_type=code&access_type=offline&approval_prompt=force\n",
            "··········\n",
            "Please, open the following URL in a web browser: https://accounts.google.com/o/oauth2/auth?client_id=32555940559.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&response_type=code&access_type=offline&approval_prompt=force\n",
            "Please enter the verification code: Access token retrieved correctly.\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "kVdTL_KFiT4G",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 50
        },
        "outputId": "be95eb46-57c8-43e8-8324-611bdfbbdecc"
      },
      "source": [
        "# Install the PyDrive wrapper & import libraries.\n",
        "# This only needs to be done once per notebook.\n",
        "!pip install -U -q PyDrive\n",
        "from pydrive.auth import GoogleAuth\n",
        "from pydrive.drive import GoogleDrive\n",
        "from google.colab import auth\n",
        "from oauth2client.client import GoogleCredentials\n",
        "\n",
        "# Authenticate and create the PyDrive client.\n",
        "# This only needs to be done once per notebook.\n",
        "auth.authenticate_user()\n",
        "gauth = GoogleAuth()\n",
        "gauth.credentials = GoogleCredentials.get_application_default()\n",
        "drive = GoogleDrive(gauth)"
      ],
      "execution_count": 3,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "\u001b[?25l\r\u001b[K     |▎                               | 10kB 20.0MB/s eta 0:00:01\r\u001b[K     |▋                               | 20kB 1.8MB/s eta 0:00:01\r\u001b[K     |█                               | 30kB 2.7MB/s eta 0:00:01\r\u001b[K     |█▎                              | 40kB 1.7MB/s eta 0:00:01\r\u001b[K     |█▋                              | 51kB 2.1MB/s eta 0:00:01\r\u001b[K     |██                              | 61kB 2.5MB/s eta 0:00:01\r\u001b[K     |██▎                             | 71kB 2.9MB/s eta 0:00:01\r\u001b[K     |██▋                             | 81kB 3.3MB/s eta 0:00:01\r\u001b[K     |███                             | 92kB 3.7MB/s eta 0:00:01\r\u001b[K     |███▎                            | 102kB 2.7MB/s eta 0:00:01\r\u001b[K     |███▋                            | 112kB 2.7MB/s eta 0:00:01\r\u001b[K     |████                            | 122kB 2.7MB/s eta 0:00:01\r\u001b[K     |████▎                           | 133kB 2.7MB/s eta 0:00:01\r\u001b[K     |████▋                           | 143kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████                           | 153kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████▎                          | 163kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████▋                          | 174kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████                          | 184kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████▎                         | 194kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████▋                         | 204kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████                         | 215kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████▎                        | 225kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████▋                        | 235kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████                        | 245kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████▎                       | 256kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████▋                       | 266kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████                       | 276kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████▎                      | 286kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████▋                      | 296kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████                      | 307kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████▎                     | 317kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████▋                     | 327kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████                     | 337kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████▎                    | 348kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████▋                    | 358kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████████                    | 368kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████████▎                   | 378kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████████▋                   | 389kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████████                   | 399kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████████▎                  | 409kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████████▋                  | 419kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████████                  | 430kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████████▎                 | 440kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████████▋                 | 450kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████████                 | 460kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████████▎                | 471kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████████▋                | 481kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████████████                | 491kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████████████▎               | 501kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████████████▋               | 512kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████████████               | 522kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████████████▎              | 532kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████████████▋              | 542kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████████████              | 552kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████████████▎             | 563kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████████████▋             | 573kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████████████             | 583kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████████████▎            | 593kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████████████▋            | 604kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████████████████            | 614kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████████████████▎           | 624kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████████████████▋           | 634kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████████████████           | 645kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████████████████▎          | 655kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████████████████▋          | 665kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████████████████          | 675kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████████████████▎         | 686kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████████████████▋         | 696kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████████████████         | 706kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████████████████▎        | 716kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████████████████▋        | 727kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████████████████████        | 737kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████████████████████▎       | 747kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████████████████████▋       | 757kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████████████████████▉       | 768kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████████████████████▏      | 778kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████████████████████▌      | 788kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████████████████████▉      | 798kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████████████████████▏     | 808kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████████████████████▌     | 819kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████████████████████▉     | 829kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████████████████████▏    | 839kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████████████████████▌    | 849kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████████████████████▉    | 860kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████████████████████████▏   | 870kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████████████████████████▌   | 880kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████████████████████████▉   | 890kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████████████████████████▏  | 901kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████████████████████████▌  | 911kB 2.7MB/s eta 0:00:01\r\u001b[K     |█████████████████████████████▉  | 921kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████████████████████████▏ | 931kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████████████████████████▌ | 942kB 2.7MB/s eta 0:00:01\r\u001b[K     |██████████████████████████████▉ | 952kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████████████████████████▏| 962kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████████████████████████▌| 972kB 2.7MB/s eta 0:00:01\r\u001b[K     |███████████████████████████████▉| 983kB 2.7MB/s eta 0:00:01\r\u001b[K     |████████████████████████████████| 993kB 2.7MB/s \n",
            "\u001b[?25h  Building wheel for PyDrive (setup.py) ... \u001b[?25l\u001b[?25hdone\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "cotE1NiaiVan",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        },
        "outputId": "142e4cfc-d327-4ba0-e9b4-c2ebd22236c8"
      },
      "source": [
        "!ls"
      ],
      "execution_count": 4,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "adc.json  sample_data\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "DTElGuCSieiC",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        },
        "outputId": "d0abfa65-7ae0-414b-c912-39639f5719b5"
      },
      "source": [
        "!ls -a"
      ],
      "execution_count": 7,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            ".  ..  adc.json  .config  sample_data\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "83-CrchPih0C",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# 重复挂载同一个名称，会报挂载点为空的现象。所以重起个名字继续挂载，\n",
        "!mkdir -p drive_2\n",
        "!google-drive-ocamlfuse drive_2"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "FQk9ib7rjI6x",
        "colab_type": "text"
      },
      "source": [
        "#到这儿硬盘挂载结束，自己的google 云盘上的文件在左边目录就可以看到了。"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "L6TuIczaiwwy",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        },
        "outputId": "be41459f-7bd1-4de9-bceb-e1b1a69be697"
      },
      "source": [
        "!ls"
      ],
      "execution_count": 9,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "adc.json  drive_2  sample_data\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "-NdJoghFjfwg",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        },
        "outputId": "16fd1703-d824-4464-bece-8a18cea28221"
      },
      "source": [
        "cd drive_2"
      ],
      "execution_count": 10,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "/content/drive_2\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Qn-SE_4sjjpw",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 67
        },
        "outputId": "8a616938-1c8a-45e1-f9b4-72966208fd77"
      },
      "source": [
        "ls"
      ],
      "execution_count": 11,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            " A3.desktop          \u001b[0m\u001b[01;34mkeras\u001b[0m/              \u001b[01;34mtest\u001b[0m/\n",
            "\u001b[01;34m'Colab Notebooks'\u001b[0m/   \u001b[01;34mMNIST_data\u001b[0m/         模型基本训练_保存_下载.ipynb\n",
            " \u001b[01;34mdata\u001b[0m/               \u001b[01;34mpython_workspace\u001b[0m/   简历.desktop\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Kk8S0ydQj6It",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# 切换到自己想去的目录 ，cd 仅仅在一个cell 里面，所以按照下面的方法切换路径"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "apKB-c3HjlTg",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "import os\n",
        "# drive_2 是自己的挂载时创建的名称，\n",
        "path = \"/content/drive_2/python_workspace/chatbot/deepQA_server/\"\n",
        "os.chdir(path)\n"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "PshHlDQikvZo",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        ""
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "FuuOSbt_joli",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        },
        "outputId": "26c76e95-debd-4f65-8f54-181dcf427655"
      },
      "source": [
        "# 现在就可以查看切换后的路径下的文件。\n",
        "!ls "
      ],
      "execution_count": 17,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "chatbot  chatbot_website  data\tmain.py  my_pre_check  mystea  README.md  save\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ej5Q6EOojvTB",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "outputId": "cf31e301-491d-4ad9-ee49-8dea54ed38a1"
      },
      "source": [
        "# 运行对应的python 文件\n",
        "!python main.py"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Welcome to chat v0.1 !\n",
            "\n",
            "TensorFlow detected: v1.14.0\n",
            "configName /content/drive_2/python_workspace/chatbot/deepQA_server/save/model/params.ini\n",
            "\n",
            "Warning: Restoring parameters:\n",
            "globStep: 18720\n",
            "watsonMode: False\n",
            "autoEncode: False\n",
            "corpus: cornell\n",
            "datasetTag: \n",
            "maxLength: 10\n",
            "filterVocab: 1\n",
            "skipLines: False\n",
            "vocabularySize: 40000\n",
            "hiddenSize: 512\n",
            "numLayers: 2\n",
            "softmaxSamples: 0\n",
            "initEmbeddings: False\n",
            "embeddingSize: 64\n",
            "embeddingSource: GoogleNews-vectors-negative300.bin\n",
            "\n",
            ">>>>>>> 导入所有对话\n",
            "Loading dataset from /content/drive_2/python_workspace/chatbot/deepQA_server/data/samples/dataset-cornell-length10-filter1-vocabSize40000.pkl\n",
            ">>>>>>>>>>>>\n",
            "Loaded cornell: 24643 words, 159657 QA\n",
            "model config start>>>>>>>\n",
            "Model creation...\n",
            "WARNING: Logging before flag parsing goes to stderr.\n",
            "W0831 02:51:10.845126 140641625622400 lazy_loader.py:50] \n",
            "The TensorFlow contrib module will not be included in TensorFlow 2.0.\n",
            "For more information, please see:\n",
            "  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md\n",
            "  * https://github.com/tensorflow/addons\n",
            "  * https://github.com/tensorflow/io (for I/O related ops)\n",
            "If you depend on functionality not listed there, please file an issue.\n",
            "\n",
            "W0831 02:51:10.845512 140641625622400 deprecation.py:323] From /content/drive_2/python_workspace/chatbot/deepQA_server/chatbot/model.py:136: BasicLSTMCell.__init__ (from tensorflow.python.ops.rnn_cell_impl) is deprecated and will be removed in a future version.\n",
            "Instructions for updating:\n",
            "This class is equivalent as tf.keras.layers.LSTMCell, and will be replaced by that in Tensorflow 2.0.\n",
            "W0831 02:51:10.857317 140641625622400 deprecation.py:323] From /content/drive_2/python_workspace/chatbot/deepQA_server/chatbot/model.py:148: MultiRNNCell.__init__ (from tensorflow.python.ops.rnn_cell_impl) is deprecated and will be removed in a future version.\n",
            "Instructions for updating:\n",
            "This class is equivalent as tf.keras.layers.StackedRNNCells, and will be replaced by that in Tensorflow 2.0.\n",
            "W0831 02:51:10.858640 140641625622400 deprecation_wrapper.py:119] From /content/drive_2/python_workspace/chatbot/deepQA_server/chatbot/model.py:154: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.\n",
            "\n",
            "2019-08-31 02:51:10.890751: W tensorflow/python/util/util.cc:280] Sets are not currently considered sequences, but this may change in the future, so consider avoiding using them.\n",
            "W0831 02:51:10.892162 140641625622400 deprecation.py:323] From /usr/local/lib/python3.6/dist-packages/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py:363: static_rnn (from tensorflow.python.ops.rnn) is deprecated and will be removed in a future version.\n",
            "Instructions for updating:\n",
            "Please use `keras.layers.RNN(cell, unroll=True)`, which is equivalent to this API\n",
            "W0831 02:51:11.401127 140641625622400 deprecation.py:506] From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/init_ops.py:1251: calling VarianceScaling.__init__ (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.\n",
            "Instructions for updating:\n",
            "Call initializer instance with the dtype argument instead of passing it to the constructor\n",
            "W0831 02:51:11.411048 140641625622400 deprecation.py:506] From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/rnn_cell_impl.py:738: calling Zeros.__init__ (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.\n",
            "Instructions for updating:\n",
            "Call initializer instance with the dtype argument instead of passing it to the constructor\n",
            "W0831 02:51:12.597342 140641625622400 deprecation.py:506] From /usr/local/lib/python3.6/dist-packages/tensorflow/contrib/rnn/python/ops/core_rnn_cell.py:104: calling Constant.__init__ (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.\n",
            "Instructions for updating:\n",
            "Call initializer instance with the dtype argument instead of passing it to the constructor\n",
            "W0831 02:51:13.259978 140641625622400 deprecation_wrapper.py:119] From /content/drive_2/python_workspace/chatbot/deepQA_server/chatbot/model.py:201: The name tf.summary.scalar is deprecated. Please use tf.compat.v1.summary.scalar instead.\n",
            "\n",
            "W0831 02:51:13.261702 140641625622400 deprecation_wrapper.py:119] From /content/drive_2/python_workspace/chatbot/deepQA_server/chatbot/model.py:204: The name tf.train.AdamOptimizer is deprecated. Please use tf.compat.v1.train.AdamOptimizer instead.\n",
            "\n",
            "W0831 02:51:17.569396 140641625622400 deprecation_wrapper.py:119] From /content/drive_2/python_workspace/chatbot/deepQA_server/chatbot/chatbot.py:215: The name tf.summary.FileWriter is deprecated. Please use tf.compat.v1.summary.FileWriter instead.\n",
            "\n",
            "W0831 02:51:17.571935 140641625622400 deprecation_wrapper.py:119] From /content/drive_2/python_workspace/chatbot/deepQA_server/chatbot/chatbot.py:216: The name tf.train.Saver is deprecated. Please use tf.compat.v1.train.Saver instead.\n",
            "\n",
            "W0831 02:51:17.615958 140641625622400 deprecation_wrapper.py:119] From /content/drive_2/python_workspace/chatbot/deepQA_server/chatbot/chatbot.py:224: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.\n",
            "\n",
            "W0831 02:51:17.616217 140641625622400 deprecation_wrapper.py:119] From /content/drive_2/python_workspace/chatbot/deepQA_server/chatbot/chatbot.py:224: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.\n",
            "\n",
            "2019-08-31 02:51:17.622539: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2300000000 Hz\n",
            "2019-08-31 02:51:17.622816: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1758d80 executing computations on platform Host. Devices:\n",
            "2019-08-31 02:51:17.622850: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): <undefined>, <undefined>\n",
            "2019-08-31 02:51:17.625274: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcuda.so.1\n",
            "2019-08-31 02:51:17.681142: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-08-31 02:51:17.682078: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1758f40 executing computations on platform CUDA. Devices:\n",
            "2019-08-31 02:51:17.682110: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): Tesla K80, Compute Capability 3.7\n",
            "2019-08-31 02:51:17.682302: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-08-31 02:51:17.682998: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties: \n",
            "name: Tesla K80 major: 3 minor: 7 memoryClockRate(GHz): 0.8235\n",
            "pciBusID: 0000:00:04.0\n",
            "2019-08-31 02:51:17.683372: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.0\n",
            "2019-08-31 02:51:17.685135: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcublas.so.10.0\n",
            "2019-08-31 02:51:17.686533: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcufft.so.10.0\n",
            "2019-08-31 02:51:17.686892: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcurand.so.10.0\n",
            "2019-08-31 02:51:17.688974: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcusolver.so.10.0\n",
            "2019-08-31 02:51:17.690279: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcusparse.so.10.0\n",
            "2019-08-31 02:51:17.700643: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudnn.so.7\n",
            "2019-08-31 02:51:17.700856: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-08-31 02:51:17.701634: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-08-31 02:51:17.702267: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 0\n",
            "2019-08-31 02:51:17.702348: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.0\n",
            "2019-08-31 02:51:17.704012: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:\n",
            "2019-08-31 02:51:17.704043: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187]      0 \n",
            "2019-08-31 02:51:17.704056: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0:   N \n",
            "2019-08-31 02:51:17.704205: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-08-31 02:51:17.704990: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero\n",
            "2019-08-31 02:51:17.705638: W tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc:40] Overriding allow_growth setting because the TF_FORCE_GPU_ALLOW_GROWTH environment variable is set. Original config value was 0.\n",
            "2019-08-31 02:51:17.705686: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10748 MB memory) -> physical GPU (device: 0, name: Tesla K80, pci bus id: 0000:00:04.0, compute capability: 3.7)\n",
            "Initialize variables...\n",
            "W0831 02:51:17.706850 140641625622400 deprecation_wrapper.py:119] From /content/drive_2/python_workspace/chatbot/deepQA_server/chatbot/chatbot.py:234: The name tf.global_variables_initializer is deprecated. Please use tf.compat.v1.global_variables_initializer instead.\n",
            "\n",
            "2019-08-31 02:51:18.425869: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set.  If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU.  To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile.\n",
            "WARNING: Restoring previous model from /content/drive_2/python_workspace/chatbot/deepQA_server/save/model/model.ckpt\n",
            "W0831 02:51:21.310668 140641625622400 deprecation.py:323] From /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/saver.py:1276: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.\n",
            "Instructions for updating:\n",
            "Use standard file APIs to check for files with this prefix.\n",
            "W0831 02:51:26.572515 140641625622400 deprecation_wrapper.py:119] From /content/drive_2/python_workspace/chatbot/deepQA_server/chatbot/chatbot.py:274: The name tf.summary.merge_all is deprecated. Please use tf.compat.v1.summary.merge_all instead.\n",
            "\n",
            "Start training (press Ctrl+C to save and exit)...\n",
            "\n",
            "----- Epoch 1/30 ; (lr=0.002) -----\n",
            "Shuffling the dataset...\n",
            "Training:   0% 0/624 [00:00<?, ?it/s]2019-08-31 02:51:31.918885: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcublas.so.10.0\n",
            "----- Step 18800 -- Loss 2.49 -- Perplexity 12.09\n",
            "----- Step 18900 -- Loss 2.41 -- Perplexity 11.11\n",
            "----- Step 19000 -- Loss 2.53 -- Perplexity 12.57\n",
            "Training:  51% 317/624 [03:30<03:18,  1.54it/s]"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "4RnoXua4jw5S",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        ""
      ],
      "execution_count": 0,
      "outputs": []
    }
  ]
}